<template>
  <div class="demo-input-suffix">
    所属断面
    <el-select v-model="value" placeholder="请选择" @change="towerChange">
      <el-option v-for="item in sectionList" :key="item.id" :label="item.sectionName" :value="item.id"></el-option>
    </el-select>
    <el-button icon="el-icon-search" class="select" @click="addProductHandle" type="primary">查询</el-button>
    <el-button icon="el-icon-plus" class="save" @click="addProductHandle" type="primary">添加</el-button>
    <el-button icon="el-icon-upload" class="ImportData" @click="ImportData" type="primary">导入数据</el-button>
  </div>
</template>

<script>
 import api from '../../../api'
export default {
  data() {
    return {
      wId:'',
      sectionList: [],
      value: '--全部--'
    }
  },
mounted () {
  this.$bus.$on('onAddmonitorPeripheryfoWid', (flag) => {
      this.wId = flag
      this.findByTunnelSction(flag)
  })
}
  ,
  methods: {
    findByTunnelSction(wid){
      api.tunnelSectionfindByWid({wid}).then(res=>{
        if (res.data.code = 2001){
          this.sectionList = res.data.data
        }
      }).catch(err=>{
        console.log(err)
      })
    },
    addProductHandle() {
      this.$bus.$emit('onAddmonitorPeripheryshow', true)
    },
    ImportData(){
      this.$bus.$emit('MonitorPeripheryUploadShow', true)
    },
    towerChange(e){
      this.$bus.$emit('onRefreshmonitorPeriphery', {wId:this.wId,sId:e})
    }
  }
}
</script>

<style scoped>
.save {
  margin-left: 10px;
}
.demo-input-suffix {
  text-align: left;
  width: 100%;
  height: 60px;
  background-color: #fff;
  padding-left: 10px;
  padding-top: 10px;
  margin-bottom: 10px;
  color: #606266;
}
.select{
  margin-left: 10px;
}

.save{
   margin-left: 10px;
   border: none;
   border: 2px solid #409EFF;
   background-color: white;
   color: #409EFF;

}
.ImportData{
  margin-left: 10px;
  border: none;
  border: 2px solid #409eff;
  background-color: white;
  color: #409eff;
}
</style>